#!/usr/bin/env python
import json

'''
json字符串和dic字典互相转（python语言提供）
'''


def test_json_func():
    dic = {'a': 123, 'b': 456}
    print(dic)
    # 转json字符串
    dic_str = json.dumps(dic)
    print(dic_str)
    # json字符串转dic
    dic_str_original = '{"a": "qwe", "b": "456"}'
    dic = json.loads(dic_str_original)
    print(dic)


if __name__ == '__main__':
    test_json_func()
